package com.huluobo.a2308douyindemo

import android.app.Application
import android.util.Log
import com.huluobo.a2308douyindemo.utils.MySp
import com.huluobo.a2308douyindemo.utils.MyToast
import com.hyphenate.chat.EMClient
import com.hyphenate.chat.EMOptions
import com.tencent.live2.V2TXLivePremier
import com.tencent.live2.V2TXLivePremier.V2TXLivePremierObserver
import com.umeng.commonsdk.UMConfigure
import com.umeng.socialize.PlatformConfig
import dagger.hilt.android.HiltAndroidApp


/**
 *  Created by LC on 2025/10/17.
 *
 *  68cb9d1ec261f27733229019
 *  moroks#2211mouthdemo
 *  友盟推送key
 *  66c47494192e0574e7667dff
 */
@HiltAndroidApp
class App : Application() {
    override fun onCreate() {
        super.onCreate()
        //自定义封装sp工具,需要初始化
        MySp.init(this)
        //自定义封装Toast,需要初始化
        MyToast.init(this)

        UMConfigure.init(this, "68cb9d1ec261f27733229019", "umeng", UMConfigure.DEVICE_TYPE_PHONE, "")

        PlatformConfig.setQQZone("101830139", "5d63ae8858f1caab67715ccd6c18d7a5")

        val options = EMOptions()
        //设置是否自动登录,这样可以不用每次都重新退出登录
        options.autoLogin = false
        options.appKey = "moroks#2211mouthdemo"
        EMClient.getInstance().init(this, options)

        //腾讯云直播初始化
        val licenceURL =
            "https://1385638540.trtcube-license.cn/license/v2/1385638540_1/v_cube.license" // 获取到的 licence url

        val licenceKey = "b7f417d8fc8bf276baf37618701d2a2c" // 获取到的 licence key

        V2TXLivePremier.setLicence(this, licenceURL, licenceKey)
        V2TXLivePremier.setObserver(object : V2TXLivePremierObserver() {
            override fun onLicenceLoaded(result: Int, reason: String) {
                Log.i("TagA", "腾讯云直播初始化 onLicenceLoaded: result:$result, reason:$reason")
            }
        })

    }
}